﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace sand_game_core
{
    public static class view
    {
        public static uint x;
        public static uint y;
        public static float multiply;
        public static Microsoft.Xna.Framework.Vector2 particle;
        public static void initialize()
        {
            x = 0;
            y = 0;
            multiply = 2;
            particle = new Microsoft.Xna.Framework.Vector2();
        }
        public static uint getX(uint px)
        {
            return px - x;
        }
        public static uint getY(uint py)
        {
            return py - y;
        }
        public static Microsoft.Xna.Framework.Vector2 getParticleRectangle(uint x, uint y)
        {
            particle.X = getX(x);
            particle.Y = 480 - getY(y);
            return particle;
        }
        public static void Update(float px, float py)
        {
            x += (Math.Cos((((Math.Atan2(x - px, y - py) * (180 / Math.PI))) + 450) % 360 * Math.PI / 180) * (Math.Sqrt(Math.Pow((px - x), 2) + Math.Pow((py - y), 2)))) + (int)x > 5 ? (uint)(Math.Cos((((Math.Atan2(x - px, y - py) * (180 / Math.PI))) + 450) % 360 * Math.PI / 180) * (Math.Sqrt(Math.Pow((px - x), 2) + Math.Pow((py - y), 2)))) : 0;
            y += (-Math.Sin((((Math.Atan2(x - px, y - py) * (180 / Math.PI))) + 450) % 360 * Math.PI / 180) * (Math.Sqrt(Math.Pow((px - x), 2) + Math.Pow((py - y), 2)))) + (int)y > 5 ? (uint)(-Math.Sin((((Math.Atan2(x - px, y - py) * (180 / Math.PI))) + 450) % 360 * Math.PI / 180) * (Math.Sqrt(Math.Pow((px - x), 2) + Math.Pow((py - y), 2)))) : 0;
        }

        public static void zoomOut()
        {
            if (multiply > 1.5)
                multiply -= 0.1f;
        }
        public static void zoomIn()
        {
            if (multiply < 15)
                multiply += 0.1f;
        }
    }
}
